﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../common/common.jsp"%>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/jquery-1.7.2.js"></script>
<script type="text/javascript">
	$(function() {
		$("a[page]").click(function() {
			var page = $(this).attr("page");
			$("input[name=page]").val(page);
			$("#query").submit();
		});
	});
</script>
<div class="main-content-right">
	<!--即时新闻-->
	<div class="main-text-box">
		<div class="main-text-box-tbg">
			<div class="main-text-box-bbg">
				<form action="<%=request.getContextPath()%>/news/list" id="query">
					<input name="title" value="${news.title }"> <input
						type="hidden" name="page"> <a href="javascript:;" page="1">查询</a>
						 <a href="<%=request.getContextPath()%>/news/toAdd" >添加</a>
				</form>
				<table cellpadding="1" cellspacing="1" class="admin-list">
					<thead>
						<tr class="admin-list-head">
							<th>新闻标题</th>
							<th>作者</th>
							<th>时间</th>
							<th>操作</th>
						</tr>
					</thead>

					<tbody>
						<c:forEach items="${page.list }" var="n">
							<tr>
								<td><a href='newsDetailView.jsp?id='>${n.title }</a>
								</td>
								<td>${n.author }</td>
								<td>${n.createDate }</td>
								<td><a href='<%=request.getContextPath()%>/news/del?id=${n.id}'>删除</a></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<div class="page-bar">
					<ul class="page-num-ul clearfix">
						<li>共 条记录&nbsp;&nbsp; / 页</li>
						<a href="javascript:;" page="1">首页</a>
						<a href="javascript:;" page="${page.page-1 }">上一页</a>
						<a href="javascript:;" page="${page.page+1 }">下一页</a>
						<a href="javascript:;" page="${page.totalPage }">尾页</a>
						${page.page}/${page.totalPage } 共${page.total}
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>
</div>